﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewsInfoEdit.aspx.cs" Inherits="CNVP.JShop.Web.Admin.NewsInfoEdit" ValidateRequest="false" %>

<%@ Register assembly="FredCK.FCKeditorV2" namespace="FredCK.FCKeditorV2" tagprefix="FCKeditorV2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
            <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="IE=7" http-equiv="X-UA-Compatible" />
    <link href="CSS/Edit.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/jquery.js" type="text/javascript"></script>
    <script src="../Scripts/Common.js" type="text/javascript"></script>
    <script type ="text/javascript">
        function KeyNum() {
            var inputHotLink = document.getElementById("<% =txtHotLink.ClientID %>").value;
            var Url = "CommonWindows/HotLinkProduct_CommonWindow.aspx";
            var result = window.showModalDialog(encodeURI(Url), 'example05', 'dialogHeight:400px;dialogLeft:200px;dialogTop:150px;center:yes;help:yes;resizable:yes;status:yes');
            if (result != null) {
                var HotLink = document.getElementById("txtHotLink").value;
                var arrayResult = result.split(",");
                var arrayHotLink = HotLink.split(",");
                var myAry = [];
                for (var i = 0; i < arrayResult.length; i++) {
                    if (!arrayHotLink.contains(arrayResult[i]))//数组交叉集
                        myAry.push(arrayResult[i]);
                }
                var resultList = "";
                if (HotLink == "") {
                    resultList = result;
                }
                else {
                    if (myAry != "") {
                        resultList = HotLink + "," + myAry;
                    }
                    else {
                        resultList = HotLink;
                    }
                }
                document.getElementById("txtHotLink").value = resultList;
                var Prolist = GetAjaxResponse("CommonWindows/AjaxNewsInfoProductList.aspx?result=" + myAry);
                $("#lbHotProList #tableEdit").append(Prolist);
            }

        }
        //热链的产品表的行上移
        function onMoveUp(line) {
            //$(this).preventDefault();
            var table = $("#tableEdit");
            //var currentContent = $(line).parent().parent().html();
            var currentRow = $(line).parent().parent().find("td:first-child").html();

            var upRow = parseInt(currentRow) - 1;
            if (upRow <= 0) {
                return;
            }
            //取得两行的内容
            var upContent = $("#tr" + upRow).html();
            var currentContent = $("#tr" + currentRow).html();

            $("#tr" + upRow).html(currentContent);
            //交换当前行与上一行内容
            $("#tr" + currentRow).html(upContent);
            $("#tr" + upRow + " td:first-child").html(upRow);
            $("#tr" + currentRow + " td:first-child").html(currentRow);
        }

        //热链的产品表的行下移
        function onMoveDown(line) {
            //$(this).preventDefault();
            var trs = $("#tableEdit>tbody>tr");
            //var trs = $(line).parent().parent().parent().find("<tr>").length;// $("#tableEdit").find("<tr>");            
            var currentRow = $(line).parent().parent().find("td:first-child").html();
            var downRow = parseInt(currentRow) + 1;
            if (downRow > trs.length) {
                return;
            }
            //取得两行的内容
            var downContent = $("#tr" + downRow).html();
            var currentContent = $("#tr" + currentRow).html();
            $("#tr" + downRow).html(currentContent);
            //交换当前行与上一行内容
            $("#tr" + currentRow).html(downContent);
            $("#tr" + downRow + " td:first-child").html(downRow);
            $("#tr" + currentRow + " td:first-child").html(currentRow);

        }

        function Del(index) {
            if (confirm("你确定要删除！")) {
                $("#tr" + index + "").remove();
                var getIdList = "";
                var ProductID = document.getElementsByName("ProductID");
                for (var i = 0; i < ProductID.length; i++) {

                    getIdList += ProductID[i].value + ",";
                }
                //alert(getIdList);
                var txtHotLink = document.getElementById("<% =txtHotLink.ClientID %>");
                txtHotLink.value = getIdList.substring(0, getIdList.length - 1);
            }
        }
        $(function () {
            $("#btUp").click(function () {
                var $ddlNewsClassID = $("#ddlNewsClassID");
                if ($ddlNewsClassID.val() == "0") {
                    alert("请选择类别！");
                    $ddlNewsClassID.focus();
                    return false;
                }
                var $txtNewsTitle = $("#txtNewsTitle");
                if ($txtNewsTitle.val() == "") {
                    alert("请输入文章标题！");
                    $txtNewsTitle.focus();
                    return false;
                }
                var $txtOriginKey = $("#txtOriginKey");
                if ($txtOriginKey.val().length > 100) {
                    alert("页面关键词过长，请不要超过100字！");
                    $txtOriginKey.focus();
                    return false;
                }
                var $txtOriginDescription = $("#txtOriginDescription");
                if ($txtOriginDescription.val().length > 100) {
                    alert("页面描述过长，请不要超过100字！");
                    $txtOriginDescription.focus();
                    return false;
                }
            });
        })
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div class="Content">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="cell">
                <tr>
                    <td class="cell_group">
                        <img src="Images/ListIconTitle.jpg" alt="" />&nbsp;您的位置：<a href="NewsInfoList.aspx">文章管理</a><asp:Label ID="lbTitle" runat="server"></asp:Label>
                    </td>
                </tr>
            </table>
                <table border="0" cellpadding="0" cellspacing="0" class="division">
                        <tr>
                            <th>
                                 类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别:</th>
                            <td>
                                 <asp:DropDownList ID="ddlNewsClassID" runat="server" Width="160px" >
                                    <asp:ListItem Value="0">--请选择--</asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                        </tr>
                        <tr>
                            <th>
                                 文章标题:</th>
                            <td>
                                  <asp:TextBox ID="txtNewsTitle" runat="server" Width="400px" MaxLength="50" />
                                </td>
                        </tr>
                        <tr>
                            <th>
                                  文章内容:</th>
                            <td>
                                <FCKeditorV2:FCKeditor ID="txtNewsContent" runat="server" Height="500px">
                                </FCKeditorV2:FCKeditor>
                                </td>
                        </tr>
                        <tr>
                            <th>
                                 显&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;示:</th>
                            <td>
                                 <asp:RadioButtonList ID="rblIsShow" runat="server" RepeatDirection="Horizontal" Width="100px" CssClass="RadioButtonListTable">
                                    <asp:ListItem Value ="1" Selected="True">是</asp:ListItem>
                                    <asp:ListItem Value ="2">否</asp:ListItem>
                                    </asp:RadioButtonList>
                                </td>
                        </tr>
                        <tr>
                            <th>
                                 热链商品:</th>
                            <td>
                                 <asp:TextBox ID="txtHotLink" runat="server" CssClass="Display" />
                                    <input id="btSelectPro" type="button" value="增加热链商品" onclick="KeyNum()" />
                                    <br />
                                    <asp:Label ID="lbHotProList" runat="server"></asp:Label>
                                    <div id="AddProductList"></div>
                                </td>
                            </tr>
                        </table>

                <h3>SEO优化(<font color="red" style="cursor:pointer" onclick="IsShowSEO()">打开请点击</font>)</h3>
                 <table border="0" cellpadding="0" cellspacing="0" class="division" id="divisionSEO" style="display:none;">
                    <tr>
                        <th>
                            页面标题:
                            </th>
                        <td>
                                <asp:TextBox ID="txtOriginTitle" runat="server" Width="255px" MaxLength="50"></asp:TextBox>
                            </td>
                    </tr>
                    <tr>
                        <th>
                                页面关键词:</th>
                        <td>
                                <asp:TextBox ID="txtOriginKey" runat="server"  TextMode="MultiLine" Rows="5" Width="455px" ></asp:TextBox>
                            </td>
                    </tr>
                    <tr>
                        <th>
                                页面描述:</th>
                        <td>
                                <asp:TextBox ID="txtOriginDescription" runat="server" TextMode="MultiLine" Rows="5" Width="455px"></asp:TextBox>
                            </td>
                    </tr>
                 </table>
                <asp:CheckBox ID="cbSEOIsShow" runat="server" CssClass="Display" />
                <script type="text/javascript">
                    function IsShowSEO() {
                        var cbSEOIsShow = document.getElementById("cbSEOIsShow");
                        if (cbSEOIsShow.checked == true) {
                            cbSEOIsShow.checked = false;
                            $("#divisionSEO").css("display", "none");
                        }
                        else {
                            cbSEOIsShow.checked = true;
                            $("#divisionSEO").css("display", "");
                        }
                    }
                </script>
            </div>
             <div class="EditBtn">  
                <asp:Button ID="btUp" runat="server" Text="提交" OnClick="btUp_Click" />
                <input type="button" value="取消" onclick="javascript:history.go(-1)" />
                </div>
    </form>
</body>
</html>
